package com.dnjn.happiness.biz.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dnjn.happiness.common.core.annotation.Excel;
import com.dnjn.happiness.common.core.model.PositionLadderVO;
import com.dnjn.happiness.common.core.model.SysPostVO;
import com.dnjn.happiness.common.core.web.domain.BaseEntity;
import com.dnjn.happiness.common.core.xss.Xss;
import com.dnjn.happiness.system.api.domain.SysDept;
import com.dnjn.happiness.system.api.domain.SysUser;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 发起培训对象 biz_training
 *
 * @author amber
 * @date 2023-10-11
 */
@Getter
@Setter
@Data
@TableName("biz_training")
public class Training extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /**  */
    @Excel(name = "")
    private String siteId;

    /** 备注 */
    @Excel(name = "备注")
    private String remark;

    /** 是否删除 */
    private String deleted;

    /** 版本号 */
    private Integer version;

    /** 开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime dateStart;

    /** 结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "结束时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime dateEnd;

    /** 状态 */
    @Excel(name = "状态")
    private String trainingStatus;

    /** 是否下发 */
    @Excel(name = "是否下发")
    private String sued;

    /** PK */
    @Excel(name = "PK")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "training_id", type = IdType.ASSIGN_ID)
    private Long trainingId;

    
    



    /** 发起人 */
    @Excel(name = "发起人")
    private String initiator;

    /** 培训主题 */
    @Excel(name = "培训主题")
    private String trainingTitle;

    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String qrcode;


    /** 内容 */
    @Xss(message = "用户昵称不能包含脚本字符")
    @Excel(name = "内容")
    private String trainingContent;

    private String trainingTagsId;

    @TableField(exist = false)
    @Schema(description = "发起人姓名",requiredMode=Schema.RequiredMode.NOT_REQUIRED)
    private String initiatorName;

    @TableField(exist = false)
    @Schema(description = "发起人头像",requiredMode=Schema.RequiredMode.NOT_REQUIRED)
    private String initiatorAvatar;

    @TableField(exist = false)
    private String trainingRecordId;

    @TableField(exist = false)
    private String trainingRecordStatus;

//    @TableField(exist = false)
//    private String myUserName;
    @TableField(exist = false)
    private String userid;

    @TableField(exist = false)
    @Schema(description = "参加人列表" ,requiredMode=Schema.RequiredMode.NOT_REQUIRED)
    private List<Long> userIds;

    @TableField(exist = false)
    private List<SysUser> userList;

    @TableField(exist = false)
    private String fromUserName;
    @Schema(description = "培训类型")
    @TableField(exist = false)
    private String label;
    @Schema(description = "头像地址")
    @TableField(exist = false)
    private String avatar;
    @TableField(exist = false)
    private String nickName;

    @TableField(exist = false)
    @Schema(description = "指定参加的部门Id集合" ,requiredMode=Schema.RequiredMode.NOT_REQUIRED)
    private List<Long> deptIdList;

    @Schema(description = "指定参加的部门Id集合" ,requiredMode=Schema.RequiredMode.NOT_REQUIRED)
    @TableField(fill = FieldFill.UPDATE)
    private String deptIds;

    @Schema(description = "指定参加岗位Id集合" ,requiredMode=Schema.RequiredMode.NOT_REQUIRED)
    @TableField(fill = FieldFill.UPDATE)
    private String postIds;

    @Schema(description = "指定参加职级集合" ,requiredMode=Schema.RequiredMode.NOT_REQUIRED)
    @TableField(fill = FieldFill.UPDATE)
    private String positionIds;

    @Schema(description = "指定参加类型" ,requiredMode=Schema.RequiredMode.NOT_REQUIRED)
//    @TableField(fill = FieldFill.UPDATE)
    private String type;

    @TableField(exist = false)
    private String result;

    @TableField(exist = false)
    private List<TrainingRecord> recordList;

    @TableField(exist = false)
    private List<SysDept> selectDeptList;

    @TableField(exist = false)
    private List<SysPostVO> selectPostList;

    @TableField(exist = false)
    private List<PositionLadderVO> selectPosttionList;

    @Schema(description = "选中的人员列表,回显用" ,requiredMode=Schema.RequiredMode.NOT_REQUIRED)
    @TableField(fill = FieldFill.UPDATE)
    private String checkedUserIds;

    @TableField(exist = false)
    private String initiatorNickName;





    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("siteId", getSiteId())
                .append("remark", getRemark())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("deleted", getDeleted())
                .append("version", getVersion())
                .append("dateStart", getDateStart())
                .append("dateEnd", getDateEnd())
                .append("trainingStatus", getTrainingStatus())
                .append("sued", getSued())
                .append("trainingId", getTrainingId())
                .append("initiator", getInitiator())
                .append("trainingTitle", getTrainingTitle())
                .append("qrCode", getQrcode())
                .append("trainingContent", getTrainingContent())
                .toString();
    }
}
